<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>商户后台</title>
    <script>
    var base_url = '__JS__';
    var URL = {};
    URL.login_send_sms = "{:U('Public/getSms')}";
    URL.login_login = "{:U('Public/login')}";
    URL.index = "{:U('Public/login')}";
    URL.shop_list = "{:U('Index/getShopList')}";
    URL.get_list = "{:U('Index/getList')}";
    </script>
    <script type="text/javascript" data-main="__JS__/app/merchant/main" src="__JS__/lib/require.js"></script>
    <link rel="stylesheet" href="__JS__/lib/bootstrap-3.3.5-dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="__JS__/lib/datetimepicker/bootstrap-datetimepicker.css">
    <style type="text/css">
    body{ font-family:'微软雅黑','microsoft yahei','新宋体','宋体',Tahoma,Verdana,Arial,Helvetica,sans-serif;}
	th,td { text-align: center; }
	.out{ position:fixed; top:10px; right:5%; }
	.input_time{ width:150px; display: inline-block; }
	</style>
</head>
<body>
	<a class="btn btn-warning out" href="{:U('Public/logout')}" onclick="return confirm('是否退出商户平台？');">退出登录</a>
	<div class="container-fluid">
        <!-- 头部 -->
        <header class="well">
            <form class="form" autocomplete="off">
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-2 col-lg-2">
                        <label style="line-height:30px;">选择活动</label>
                        <select id="activity_id" class="form-control select2" name="activity_id" style="width:200px;">
							<option value="0">选择活动</option>
							<volist name="activity_array" id="vo">
								<option value="{$vo.activity_id}">{$vo.activity_name}</option>
							</volist>
							{$Think.config.ACTIVITY_TTTM}
						</select>
                    </div>
                    <div class="col-xs-12 col-sm-12 col-md-2 col-lg-2">
                    	<label style="line-height:30px;">选择店铺</label>
                    	<select class="form-control select2" disabled="true" id="shop_id" name="shop_id" style="width:200px;"><option>选择店铺</option></select>
                    </div>
                    
                    <div class="form-group col-xs-12 col-sm-12 col-md-3 col-lg-3">
                        <label style="line-height:30px;">纸质订单号</label>
                        <input type="text" class="form-control" id="paper_order" name="paper_order" placeholder="纸质订单号" onkeydown="if(event.keyCode == 13) return false;">
						<input type="hidden" id="page" name="page" value="0">
                    </div>

                    <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
                        <div><label style="line-height:30px;">选择状态</label></div>
                        <div class="btn-group" data-toggle="buttons">
                            <label class="btn btn-sm btn-default active">
                                <input type="radio" name="order_status" value="0" checked>全部
                            </label>
                            <label class="btn btn-sm btn-default">
                                <input type="radio" name="order_status" value="2" >未申请
                            </label>
                            <label class="btn btn-sm btn-default">
                                <input type="radio" name="order_status" value="5" >处理中
                            </label>
                            <label class="btn btn-sm btn-default">
                                <input type="radio" name="order_status" value="7" >已返款
                            </label>
                            <label class="btn btn-sm btn-default">
                                <input type="radio" name="order_status" value="3" >已退款
                            </label>
                        </div>
                    </div>    
                    
                </div>
                
                
                <div class="row">
                	<div class="form-group col-xs-12 col-sm-12 col-md-3 col-lg-3">
                        <label style="line-height:30px;">下单时间</label><br>
                        <input type="text" class="form-control input_time datepicker" name="start_time" placeholder="开始时间" ><input type="text" class="form-control input_time datepicker" name="end_time" placeholder="结束时间" >
                    </div>
                    <div class="form-group col-xs-12 col-sm-12 col-md-3 col-lg-3">
                        <label style="line-height:30px;">申请核销时间</label><br>
                        <input type="text" class="form-control input_time datepicker" name="apply_start_time" placeholder="开始时间" ><input type="text" class="form-control input_time datepicker" name="apply_end_time" placeholder="结束时间" >
                    </div>
                    <div class="form-group col-xs-12 col-sm-12 col-md-3 col-lg-3">
                        <label style="line-height:30px;">返款时间</label><br>
                        <input type="text" class="form-control input_time datepicker" name="back_start_time" placeholder="开始时间" ><input type="text" class="form-control input_time datepicker" name="back_end_time" placeholder="结束时间" >
                    </div>
                </div>
                
                <div class="visible-xs-block visible-sm-block" style="height:15px;"></div>

                <div class="form-control-static">
                    <button id="search" type="button" class="btn btn-success"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                </div>
                
            </form>
        </header>   
        <!-- /头部 -->
        
        <!-- 主体 -->
        <section>
            <div class="table-responsive">
                <table class="table table-bordered">
            		<tbody id="list_title" style="display:none;" >
	                    <tr>
	                        <th class="phone_hide">序号</th>
							<th class="phone_hide">订单</th>
							<th>纸质订单</th>
							<th class="phone_hide">店铺</th>
							<!-- <th class="phone_hide">品类</th> -->
							<th>金额</th>
							<th class="phone_hide">手机</th>
							<th class="phone_hide">下单时间</th>
							<th class="phone_hide">申请核销时间</th>
							<th class="phone_hide">返款时间</th>
							<th>状态</th>
							<th>详情</th>
	                    </tr>
	                </tbody>
                    <tbody id="list_body" style="display:none;"></tbody>
					<tbody id="no_list">
						<tr>
							<td>请根据搜索条件进行查询</td>
						</tr>
					</tbody>
					<tbody id="loading" style="display:none;">
						<tr>
							<td><img width="50px" src="__IMG__/load.gif"></td>
						</tr>
					</tbody>
            	</table>
            </div>
            <div id="list_body_page" style="display:none;"></div>
        </section>
        <!-- 主体 -->
        
        <!-- 尾部 -->
        <footer>
            
        </footer>
        <!-- 尾部 -->

    </div>
    <script>
    var jump_index = -1;
    function jump(page){
    	jump_index = page;
        $('#page').val(page);
        $('#search').trigger('click');
    }
    //申请
    function apply(order_id, order_number){
        if(order_id == null || order_id == ""){
            alert('参数错误');
            return;
        }
        var number = prompt("请输入纸质订单：" + order_number + " 付款凭证上的识别码（6位）：" ,"")
        if (number != null && number != ""){
            var data = { order_id : order_id, number : number }
            $.post("{:U('apply')}", data, function(json) {
                if (0 == json.status) {
                    alert(json.info);
                } else {
                    alert(json.info);
                    $('#search').trigger('click');
                }
            }, "json");
        }
    }
    </script>
</body>
</html>